﻿/*=================================================================
* 版权信息：Copyright (C) 2005-2011 捷点科技 All Rights Reserved.
* 文件名称：CNVP_Users.cs
* 创建标识：曾乃强 15158756652 2011-03-18 01:03:05
* 修改标识：
* 功能描述：
===================================================================*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using CNVP.Framework;
using CNVP.Framework.Helper;

namespace CNVP.JShop.BLL 
{
    /// <summary>
    /// 对*CNVP_Users*操作(针对业务层)的实现
    /// </summary>
    public class CNVP_Users
    {
        DAL.CNVP_Users dal = new DAL.CNVP_Users();
        
        #region BLL
        #region 添加
        /// <summary>
        /// 添加
        /// </summary>
        public int Add_CNVP_Users(Model.CNVP_Users obj)
        {
            return dal.Insert(obj);
        }
        #endregion
        
        #region 修改
        /// <summary>
        /// 修改
        /// </summary>
        public int Update_CNVP_Users(Model.CNVP_Users obj)
        {
            return dal.Update(obj);
        }
        #endregion
        
        #region 删除
        /// <summary>
        /// 删除
        /// </summary>
        public int Delete_CNVP_Users(Model.CNVP_Users obj)
        {
            return dal.Delete(obj);
        }
        
        /// <summary>
        /// 删除,生成列的主键列构成的参数列表
        /// </summary>
        public int Delete_CNVP_Users(int ID)
        {
            return this.Delete_CNVP_Users(new Model.CNVP_Users() {
            
                 ID=ID
            });
        }
        #endregion 
        
        /// <summary>
        /// 查看单个
        /// </summary>
        public Model.CNVP_Users GetSingle_CNVP_UsersById(int ID)
        {
            return dal.LoadById(ID);
        }
        /// <summary>
        /// 查看全部,sqlWhere
        /// </summary>
        public List<Model.CNVP_Users> GetAll_CNVP_Users(string sqlWhere)
        {
            return dal.LoadAll(sqlWhere);
        }
        /// <summary>
        /// 查看全部
        /// </summary>
        public List<Model.CNVP_Users> GetAll_CNVP_Users()
        {
            return this.GetAll_CNVP_Users("");
        }
        #endregion

        public DataTable GetPage(string PageName, int PageIndex, int PageSize, out int RecordCount, out int PageCount, params SQLConditionInfo[] SqlCondition)
        {
            return dal.GetPage(PageName, PageIndex, PageSize, out RecordCount, out PageCount, SqlCondition);
        }

        public int UpdatePointsNum(int ID, int pointsNum)
        {
            return dal.UpdatePointsNum(ID, pointsNum);
        }

        /// <summary>
        /// 更新积分:"0"代表"-",1代表"+"
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="pointsNum">当前更新的积分</param>
        public int UpdatePointsNumType(int ID, int PointsNum, int type)
        {
            return dal.UpdatePointsNumType(ID, PointsNum, type);
        }

        public List<Model.CNVP_Users> QurryListByUserName(string UserName)
        {
            return dal.QurryListByUserName(UserName);
        }

        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="UserName">用户名</param>
        /// <param name="UserPwd">密码</param>
        /// <returns></returns>
        public Model.CNVP_Users cust_LoginByName(Model.CNVP_Users obj)
        {
            return dal.cust_LoginByName(obj);
        }

        /// <summary>
        /// 找回密码
        /// </summary>
        /// <param name="UserName"></param>
        /// <param name="Email"></param>
        /// <returns></returns>
        public Model.CNVP_Users GetSingle_CNVP_UsersByUserName(string UserName, string Email)
        {
            return dal.LoadByUserName(UserName, Email);
        }

        /// <summary>
        /// 判断是否存在旧密码
        /// </summary>
        public int IsOldPwd(string OldPwd, string UserName)
        {
            return dal.IsOldPwd(OldPwd, UserName);
        }

        /// <summary>
        /// 旧密码存在，更新密码。和初始化密码
        /// </summary>
        public int UpdatePwd(string UserPass, string UserName)
        {
            return dal.UpdatePwd(UserPass, UserName);
        }

        /// <summary>
        /// 会员中心资料管理
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="UserName"></param>
        /// <returns></returns>
        public int UpdateByUserName(Model.CNVP_Users obj)
        {
            return dal.UpdateByUserName(obj);
        }

        public int UpdateUserLevelID(int ID, int UserLevelID)
        {
            return dal.UpdateUserLevelID(ID, UserLevelID);
        }

        public int cust_UpdateLogin(Model.CNVP_Users obj)
        {
            return dal.cust_UpdateLogin(obj);
        }
    }
}

